using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// BBS_List - 论坛主题表 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class IBBSList<T> :ModelBase<BBSList> where T : BBSList, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.BbsId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return BbsId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.BbsId=dy.BbsId;
           this.PlateId=dy.PlateId;
           this.UserId=dy.UserId;
           this.Title=dy.Title;
           this.ContentId=dy.ContentId;
           this.SubmitTime=dy.SubmitTime;
           this.EditTime=dy.EditTime;
           this.ReplyTime=dy.ReplyTime;
           this.TopTime=dy.TopTime;
           this.TitleColor=dy.TitleColor;
           this.IsTop=dy.IsTop;
           this.IsCloseReply=dy.IsCloseReply;
           this.IsClose=dy.IsClose;
           this.Sno=dy.Sno;
           this.Version=dy.Version;
        } 

        #region 定义属性

     
         /// <summary>
        /// 主题ID
        /// </summary>
        private String _BbsId = "";
      
        /// <summary>
        /// 主题ID
        /// </summary>
        public String BbsId
        {
            get 
            {
              return   (this._BbsId); 
            }

            set 
            {
                    _BbsId= value;  
            }
        }
       
     
         /// <summary>
        /// 版块ID
        /// </summary>
        private String _PlateId = "";
      
        /// <summary>
        /// 版块ID
        /// </summary>
        public String PlateId
        {
            get 
            {
              return   (this._PlateId); 
            }

            set 
            {
                    _PlateId= value;  
            }
        }
       
     
         /// <summary>
        /// 用户ID
        /// </summary>
        private String _UserId = "";
      
        /// <summary>
        /// 用户ID
        /// </summary>
        public String UserId
        {
            get 
            {
              return   (this._UserId); 
            }

            set 
            {
                    _UserId= value;  
            }
        }
       
     
         /// <summary>
        /// 标题
        /// </summary>
        private String _Title = "";
      
        /// <summary>
        /// 标题
        /// </summary>
        public String Title
        {
            get 
            {
              return   (this._Title); 
            }

            set 
            {
                    _Title= value;  
            }
        }
       
     
         /// <summary>
        /// 内容
        /// </summary>
        private String _ContentId = "";
      
        /// <summary>
        /// 内容
        /// </summary>
        public String ContentId
        {
            get 
            {
              return   (this._ContentId); 
            }

            set 
            {
                    _ContentId= value;  
            }
        }
       
     
         /// <summary>
        /// 创建时间
        /// </summary>
        private DateTime _SubmitTime =DateTime.MinValue;
      
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime SubmitTime
        {
            get 
            {
              return   (this._SubmitTime); 
            }

            set 
            {
                    _SubmitTime= value;  
            }
        }
       
     
         /// <summary>
        /// 修改时间
        /// </summary>
        private DateTime _EditTime =DateTime.MinValue;
      
        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime EditTime
        {
            get 
            {
              return   (this._EditTime); 
            }

            set 
            {
                    _EditTime= value;  
            }
        }
       
     
         /// <summary>
        /// 被回复时间
        /// </summary>
        private DateTime _ReplyTime =DateTime.MinValue;
      
        /// <summary>
        /// 被回复时间
        /// </summary>
        public DateTime ReplyTime
        {
            get 
            {
              return   (this._ReplyTime); 
            }

            set 
            {
                    _ReplyTime= value;  
            }
        }
       
     
         /// <summary>
        /// 置顶时间
        /// </summary>
        private DateTime _TopTime =DateTime.MinValue;
      
        /// <summary>
        /// 置顶时间
        /// </summary>
        public DateTime TopTime
        {
            get 
            {
              return   (this._TopTime); 
            }

            set 
            {
                    _TopTime= value;  
            }
        }
       
     
         /// <summary>
        /// 标题颜色
        /// </summary>
        private String _TitleColor = "";
      
        /// <summary>
        /// 标题颜色
        /// </summary>
        public String TitleColor
        {
            get 
            {
              return   (this._TitleColor); 
            }

            set 
            {
                    _TitleColor= value;  
            }
        }
       
     
         /// <summary>
        /// 是否置顶
        /// </summary>
        private int _IsTop =-1;
      
        /// <summary>
        /// 是否置顶
        /// </summary>
        public yq.Enums.BooleanType IsTop
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsTop; 
            }

            set 
            {
                    _IsTop= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 是否关闭评论
        /// </summary>
        private int _IsCloseReply =-1;
      
        /// <summary>
        /// 是否关闭评论
        /// </summary>
        public yq.Enums.BooleanType IsCloseReply
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsCloseReply; 
            }

            set 
            {
                    _IsCloseReply= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 是否被删除
        /// </summary>
        private int _IsClose =-1;
      
        /// <summary>
        /// 是否被删除
        /// </summary>
        public yq.Enums.BooleanType IsClose
        {
            get 
            {
              return  (yq.Enums.BooleanType)_IsClose; 
            }

            set 
            {
                    _IsClose= value.GetHashCode(); 
            }
        }
       
     
         /// <summary>
        /// 排序
        /// </summary>
        private int _Sno =int.MinValue;
      
        /// <summary>
        /// 排序
        /// </summary>
        public int Sno
        {
            get 
            {
              return   (this._Sno); 
            }

            set 
            {
                    _Sno= value;  
            }
        }
       
     

      #endregion 定义属性 

          protected internal override void SetValue(BBSList info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["BbsId"]!= DBNull.Value)
                  {
                  info.BbsId=row["BbsId"].ToString();
                 }
                 
                  
                  if(row["PlateId"]!= DBNull.Value)
                  {
                  info.PlateId=row["PlateId"].ToString();
                 }
                 
                  
                  if(row["UserId"]!= DBNull.Value)
                  {
                  info.UserId=row["UserId"].ToString();
                 }
                 
                  
                  if(row["Title"]!= DBNull.Value)
                  {
                  info.Title=row["Title"].ToString();
                 }
                 
                  
                  if(row["ContentId"]!= DBNull.Value)
                  {
                  info.ContentId=row["ContentId"].ToString();
                 }
                 
                  
                  if(row["SubmitTime"]!= DBNull.Value)
                  {
                  info.SubmitTime=Convert.ToDateTime(row["SubmitTime"]);
                 }
                 
                  
                  if(row["EditTime"]!= DBNull.Value)
                  {
                  info.EditTime=Convert.ToDateTime(row["EditTime"]);
                 }
                 
                  
                  if(row["ReplyTime"]!= DBNull.Value)
                  {
                  info.ReplyTime=Convert.ToDateTime(row["ReplyTime"]);
                 }
                 
                  
                  if(row["TopTime"]!= DBNull.Value)
                  {
                  info.TopTime=Convert.ToDateTime(row["TopTime"]);
                 }
                 
                  
                  if(row["TitleColor"]!= DBNull.Value)
                  {
                  info.TitleColor=row["TitleColor"].ToString();
                 }
                 
                  
                  if(row["IsTop"]!= DBNull.Value)
                  {
                  info.IsTop= (yq.Enums.BooleanType)(row["IsTop"]) ;
                 }
                 
                  
                  if(row["IsCloseReply"]!= DBNull.Value)
                  {
                  info.IsCloseReply= (yq.Enums.BooleanType)(row["IsCloseReply"]) ;
                 }
                 
                  
                  if(row["IsClose"]!= DBNull.Value)
                  {
                  info.IsClose= (yq.Enums.BooleanType)(row["IsClose"]) ;
                 }
                 
                  
                  if(row["Sno"]!= DBNull.Value)
                  {
                  info.Sno=Convert.ToInt32(row["Sno"]);
                 }
                 
                  
                  if(row["Version"]!= DBNull.Value)
                  {
                  info.Version=row["Version"].ToString();
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, BBSList info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@BbsId", DbType.String,ParameterTool.GetObj( info._BbsId )); 
            
             
                cn.AddInParameter(comm, "@PlateId", DbType.String,ParameterTool.GetObj( info._PlateId )); 
            
             
                cn.AddInParameter(comm, "@UserId", DbType.String,ParameterTool.GetObj( info._UserId )); 
            
             
                cn.AddInParameter(comm, "@Title", DbType.String,ParameterTool.GetObj( info._Title )); 
            
             
                cn.AddInParameter(comm, "@ContentId", DbType.String,ParameterTool.GetObj( info._ContentId )); 
            
             
                cn.AddInParameter(comm, "@SubmitTime", DbType.DateTime,ParameterTool.GetObj( info._SubmitTime )); 
            
             
                cn.AddInParameter(comm, "@EditTime", DbType.DateTime,ParameterTool.GetObj( info._EditTime )); 
            
             
                cn.AddInParameter(comm, "@ReplyTime", DbType.DateTime,ParameterTool.GetObj( info._ReplyTime )); 
            
             
                cn.AddInParameter(comm, "@TopTime", DbType.DateTime,ParameterTool.GetObj( info._TopTime )); 
            
             
                cn.AddInParameter(comm, "@TitleColor", DbType.String,ParameterTool.GetObj( info._TitleColor )); 
            
             
                cn.AddInParameter(comm, "@IsTop", DbType.Int32,ParameterTool.GetObj( info._IsTop )); 
            
             
                cn.AddInParameter(comm, "@IsCloseReply", DbType.Int32,ParameterTool.GetObj( info._IsCloseReply )); 
            
             
                cn.AddInParameter(comm, "@IsClose", DbType.Int32,ParameterTool.GetObj( info._IsClose )); 
            
             
                cn.AddInParameter(comm, "@Sno", DbType.Int32,ParameterTool.GetObj( info._Sno )); 
            
                
                cn.AddInParameter(comm,"@Version", DbType.String, Guid.NewGuid().ToString());
              

                cn.AddInParameter(comm,"@_versionOdl", DbType.String, info._Version); 
                 
        } 

    } 
} 